package com.macro.mall.common.enums;

import lombok.Getter;

import javax.validation.constraints.NotBlank;

/**
 * 短信模板枚举
 */
@Getter
public enum SmsTemplateEnum {

    /**
     * 验证码
     */
    LOGIN_VERIFY_CODE("01", "891481", "登录短信验证码"),
    REGISTER_VERIFY_CODE("02", "891746", "注册短信验证码"),
    RESET_PASS_VERIFY_CODE("03", "891748", "重置密码短信验证码")
    ;

    private final String type;
    private final String id;
    private final String msg;

    SmsTemplateEnum(String type, String id, String msg) {
        this.type = type;
        this.id = id;
        this.msg = msg;
    }

    public static SmsTemplateEnum findByType(@NotBlank String type){
        for(SmsTemplateEnum templateEnum: SmsTemplateEnum.values()){
            if(type.equals(templateEnum.getType())){
                return templateEnum;
            }
        }
        return null;
    }

}
